package com.hyf.glidev4.activity;

import android.os.Bundle;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.hyf.glidev4.BaseActivity;
import com.hyf.glidev4.R;

import butterknife.BindView;

public class GlideBaseActivity extends BaseActivity {
    @BindView(R.id.iv_base_01)
    ImageView image01;

    @BindView(R.id.iv_base_02)
    ImageView image02;

    @BindView(R.id.iv_base_03)
    ImageView image03;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_glide_base);
        setTitle("基础使用");
        RequestOptions options = RequestOptions.centerCropTransform();
        // 加载资源文件
        Glide.with(this).load(R.mipmap.mengmei01).apply(options).into(image01);

        // 加载网络图片
        Glide.with(this).load("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1513772653993&di=308d44505fbbb8f8509482a98fc800c7&imgtype=0&src=http%3A%2F%2Fimg5.duitang.com%2Fuploads%2Fitem%2F201512%2F06%2F20151206111939_nN4G8.jpeg")
                .apply(options)
                .into(image02);

        // 加载网络gif图片
        Glide
                .with(this)
                .load("http://p1.pstatp.com/large/50180000d94ec30af431")
                .into(image03);
    }

    @Override
    protected boolean setDisplayHomeAsUpEnabled() {
        return true;
    }
}
